package com.yshy.moviechoseseatinginnerapi.controller;

import cn.jhsjgo.commonmodel.base.ResultBean;
import com.yshy.moviechoseseatinginnerapi.service.OrdersService;
import com.yshy.moviechoseseatingcommon.entity.bo.orders.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.security.NoSuchAlgorithmException;

/**
 * @author :
 * @desc :
 * @create: 下午1:43
 **/
@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Autowired
    OrdersService ordersService;
    /**
     * 下单检查接口
     * @param bo
     * @return
     */
    @PostMapping("checkCreateOrder")
    public ResultBean<String>  checkCreateOrder(@RequestBody @Valid CreateMovieOrderBo bo){
        return ordersService.checkCreateOrder(bo);
    }
    /**
     * 创建订单(备用金支付)
     * @param bo
     * @return
     */
    @PostMapping("createMovieOrder")
    public String createMovieOrder(@RequestBody @Valid OrderIdBo bo){
        return ordersService.createMovieOrder(bo);
    }
    /**
     * 订单退款
     * @param bo
     * @return
     */
    @PostMapping("refundMovieOrder")
    public String refundMovieOrder(@RequestBody @Valid RefundMovieOrderBo bo){
        return ordersService.refundMovieOrder(bo);
    }
    /**
     * 订单事件通知
     * @param bo
     * @return
     */
    @PostMapping("notice")
    public String notice(@RequestBody @Valid NoticeBo bo) throws NoSuchAlgorithmException, InterruptedException {
        return ordersService.notice(bo);
    }

    /**
     * 根据订单号查询订单
     * @param bo
     * @return
     */
    @PostMapping("getByOrderNo")
    public String getByOrderNo(@RequestBody @Valid GetByOrderNoBo bo){
        return ordersService.getByOrderNo(bo);
    }
    /**
     * 根据平台订单号查询订单
     * @param bo
     * @return
     */
    @PostMapping("getByPlatformOrderNo")
    public String getByPlatformOrderNo(@RequestBody GetByPlatformOrderNoBo bo){
        return ordersService.getByPlatformOrderNo(bo);
    }
    /**
     * 根据批量订单号查询订单
     * @param bo
     * @return
     */
    @PostMapping("listByBatchOrderNos")
    public String listByBatchOrderNos(@RequestBody @Valid ListByBatchOrderNosBo bo){
        return ordersService.listByBatchOrderNos(bo);
    }
    /**
     * 分页查询订单
     * @param bo
     * @return
     */
    @PostMapping("pagedQuery")
    public String pagedQuery(@RequestBody @Valid PagedsQueryBo bo){
        return ordersService.pagedQuery(bo);
    }
}
